Answer:

No, mostly the syntax rules just tell you how it looks.

What the FOR Statement Does

Here is the general form of the FOR (again):

FOR counter = startingValue TO endingValue
  loopBody
NEXT counter

Some rules about how the FOR statement works:

  1. The first time loopBody is executed, counter has the value startingValue.
  2. Each time control hits the NEXT counter statement, counter is increased by 1, and control is sent back to the top.
  3. The final time loopBody is executed, counter has the value endingValue.
  4. If startingValue is greater than endingValue, the loopBody will not be executed even once.

The last rule looks a little odd, but sometimes it is important. Here is a program that illustrates it:

' Counting Loop 
'
LET START = 7
LET FINISH = 5
FOR I = START TO FINISH
  PRINT I;  
NEXT I  
END

QUESTION 9:

  1. Is the program's syntax correct?
  2. What does the program print out?